/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Vue;

import Fenetre.FenetreCreer;
import Fenetre.FenetreRecherche;
import Fenetre.FenetreResultatRecherche;
import java.io.File;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JFrame;
import org.jopendocument.dom.OOUtils;



/**
 *
 * @author gerard.dl02
 */
public class Vue implements Observer{
    
    JFrame fenetreActive;
    
    public void init(){
        
       // FenetreRecherche fenetre = new FenetreRecherche();
          this.fenetreActive = new FenetreCreer();
    }

    public void afficherFenetreCreer () {
        
        this.fenetreActive.dispose();
        this.fenetreActive = new FenetreCreer();
    }
    
    public void afficherFenetreRechercher () {
        
        this.fenetreActive.dispose();
        this.fenetreActive = new FenetreRecherche();
    }

    
    
    
    
    @Override
    public void update(Observable o, Object o1) {
        
        if(o1 instanceof ArrayList){
            
            FenetreResultatRecherche resultat = new FenetreResultatRecherche();
            
            
            
        }
        else if(o1 instanceof Exception){
            
            //fenetre erreur
        
        }
             else if (o1 instanceof File){
                 try {
                
                     
                      OOUtils.open((File)o1);
                     
            } catch (Exception e) {
                
                //fenetre erreur
                
            }
                
                 
             }
            
            
    }
   
    
    
}
